//
//  CTabBarController.m
//  CarLife
//
//  Created by yu on 2019/3/27.
//  Copyright © 2019年 jpas. All rights reserved.
//

#import "CTabBarController.h"
#import "CommunityViewController.h"
#import "UIView+TransitionAnimation.h"
#import "UIImage+CLImage.h"
#import "MineViewController.h"
#import "CNavigationController.h"

@interface CTabBarController ()

@end

@implementation CTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupAllChildViewControllers];
}

- (void)setupAllChildViewControllers {
    
    CommunityViewController *community = [[CommunityViewController alloc] init];
    [self setupChildViewController:community image:[UIImage imageNamed:@"community"] selectImage:[UIImage imageWithOriginalName:@"community_select"] title:@"社区"];
    
    MineViewController *mine = [[MineViewController alloc] init];
    [self setupChildViewController:mine image:[UIImage imageNamed:@"mine"] selectImage:[UIImage imageWithOriginalName:@"mine_select"] title:@"我的"];
}

- (void)setupChildViewController:(UIViewController *)viewController image:(UIImage *)image selectImage:(UIImage *)selectImage title:(NSString *)title{
    
    viewController.title = title;
    viewController.tabBarItem.image = image;
    viewController.tabBarItem.selectedImage = selectImage;
    
    CNavigationController *nav = [[CNavigationController alloc] initWithRootViewController:viewController];
    [self addChildViewController:nav];
}

@end
